import '@unocss/reset/normalize.css'
import '@/assets/styles/global.css'
import 'virtual:uno.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { VueQueryPlugin } from '@tanstack/vue-query'
import { Message, Notification } from '@arco-design/web-vue'

import App from '@/App.vue'
import router from '@/router'
import { i18n } from '@/locales'
import { queryClient } from '@/apis/client'

setup()

async function setup() {
  if (import.meta.env.VITE_MOCK_ENABLE === 'true') {
    const { enableMock } = await import('@/mocks')
    await enableMock()
  }

  const app = createApp(App)

  Message._context = app._context
  Notification._context = app._context

  app.use(createPinia())
  app.use(router)
  app.use(i18n)
  app.use(VueQueryPlugin, { queryClient })

  app.mount('#app')
}
